<template>
	<view>
		<view class="header" :style="'padding-top: '+bartop+'px; padding-bottom:10rpx;background: rgba(0, 0, 0, 0);'">
			<view class="goodsmsgheader headertop" style="width: 100%;">
				<navigator open-type="navigateBack" style="padding:10rpx">
					<image src="https://x.bilinmeiju.com/static/myfangchan/zjt.png" mode="aspectFit"></image>
				</navigator>
				<text></text>
				<!-- <image src="/static/goodsmsghei.png" mode="aspectFit" bindtap="showmsg" wx:if="{{cartlen=='00'?false:true}}"><text>{{cartlen}}</text></image> -->
			</view>
		</view>
		<view class="top">
			<image class="top" src="../../../static/lifebj.png" mode="aspectFill"></image>
			<view class="top1">
				<view class="">
					<view class="top1text">
						生活缴费
					</view>
					<view class="top1text1">
						线上缴费 智慧生活不迷路
					</view>
					<picker :range="myroom" :value="sqindex" range-key="roomname" @change="shequxuanze">
						<view class="top1-1">
							<view class="top1-1text">
								{{myroom[sqindex].shequ||''}}{{myroom[sqindex].roomname||'无相关房产'}}
							</view>
							<image src="../../../static/xshanjiao.png" mode=""></image>
						</view>
					</picker>
				</view>
				<image src="/static/lifebjsp.png" mode=""></image>
			</view>
		</view>
		<view class="" style="position: absolute;
		top: 400rpx;
		left: 10rpx;">

			<view class="box">
				<view class="" style="width: 100rpx;height: 10rpx;"></view>
				<view class="box1">
					生活缴费
				</view>
				<view class="box2">
					<view class="box2-1" v-for="(item,index) in mypro" :key="index">
						<image :src="item.icon[0]" mode=""></image>
						<view class="">{{item.title}}</view>
					</view>
				</view>
			</view>

			<view class="box">
				<view class="" style="width: 100rpx;height: 40rpx;"></view>
				<view class="box-1">
					<view class="box-1-1">
						我的缴费
					</view>
					<view class="box-1-2" @click="$gopage('/pages/center/liftpay/zdlist?roomId='+roomId,1,1)">
						<view class="box-1-2text">
							缴费记录
						</view>
						<image src="/static/yjiant.png" mode=""></image>
					</view>
				</view>
				<view class="box-2" v-for="(item,index) in zhangdan" :key="index"
					@click="$gopage('/pages/center/liftpay/enterpay?id='+item.id,1,1)">
					<view class="box-2-1">
						<image src="/static/lifetx.png" mode=""></image>
						<view class="box-2-2">
							<view class="box-2-2text">{{item.title}}</view>
							<view class="box-2-2text1">{{item.paytime}}</view>
						</view>
					</view>
					<image src="../../../static/yfh.png" mode=""></image>
				</view>


			</view>
		</view>
		<box ref="box"></box>
	</view>
</template>

<script>
	//首页
	var that
	export default {
		data() {
			return {
				bartop: 0,
				myroom: [],
				sqindex: 0,
				roomId: '',
				mypro: [],
				zhangdan: [],
				nextp: 1,

			}
		},
		onLoad(e) {
			that = this
			that.bartop = that.$bartop;
		},
		onShow() {
			this.nextp = 1
			that.getmyroom()
		},
		methods: {
			getmyroom() {
				that.$post('center/getmyroom', {}).then(res => {
					if (res.data.list.length > 0) {
						that.myroom = res.data.list
						that.roomId = that.myroom[0].roomId
						that.getmypro()
						that.roomzhangdan()
					} else {
						that.showbind();
					}
				})
			},
			getmypro() {
				that.$post('center/getmypro', {
					roomId: that.roomId
				}).then(res => {
					that.mypro = res.data.list
				})
			},
			roomzhangdan() {
				if (that.nextp) {
					that.$post('center/roomzhangdan', {
						roomId: that.roomId,
						p: that.nextp
					}).then(res => {
						if (this.nextp == 1) {
							that.zhangdan = res.list
						} else {
							res.list.forEach(item => {
								that.zhangdan.push(item)
							})
						}
						that.nextp = res.data.nextp
					})
				}

			},
			shequxuanze(e) {
				that.sqindex = e.detail.value
				that.roomId = myroom[e.detail.value].roomId
			},
			showbind() {
				var box = {
					isshow: true,
					title: '请绑定房产',
					content: '请先进行房产绑定',
					content2: '然后进行数据录入',
					btntitle: '去绑定',
					path: '/pages/fangchanbangding/fangchanbangding'
				}
				this.box = box;
				this.$refs.box.open(box)
			},

		}
	}
</script>

<style lang="scss">
	.top {
		width: 750rpx;
		height: 557rpx;
		z-index: -1;
	}

	.top1 {
		margin-top: -500rpx;
		display: flex;
		align-items: center;
		justify-content: center;

		>image {
			width: 313rpx;
			height: 426rpx;
		}
	}

	.top1text {
		font-size: 40rpx;
		font-family: YouSheBiaoTiHei;
		font-weight: 600;
		color: #FFFFFF;

	}

	.top1text1 {
		margin-top: 20rpx;
		margin-bottom: 40rpx;
		font-size: 24rpx;
		font-family: Alibaba PuHuiTi;
		font-weight: 500;
		color: #FFFFFF;
	}

	.top1-1 {
		display: flex;
		align-items: center;

		.top1-1text {
			font-size: 26rpx;
			font-family: Alibaba PuHuiTi;
			font-weight: 500;
			color: #FFFFFF;
		}

		>image {
			margin: 0 20rpx;
			width: 20rpx;
			height: 12rpx;
		}
	}

	.box {
		width: 727rpx;
		height: 484rpx;
		// background-image: url('../../../static/lifebox.png');
		// background-size: 727rpx;
		border-radius: 40rpx;
		background-color: white;

		z-index: 9;

		.box1 {
			font-size: 30rpx;
			font-family: Alibaba PuHuiTi;
			font-weight: 600;
			color: #333333;
			margin: 40rpx;
		}
	}

	.box2 {
		display: flex;
		flex-wrap: wrap;



		.box2-1 {
			width: 240rpx;
			display: flex;
			flex-direction: column;
			align-items: center;
			justify-content: center;

			>image {
				width: 57rpx;
				height: 57rpx;
				margin: 20rpx 0;
			}

			>view {
				font-size: 24rpx;
				font-family: Alibaba PuHuiTi;
				font-weight: 500;
				color: #333333;
				margin-bottom: 40rpx;
			}
		}


	}

	.box-1 {
		width: 86vw;
		margin: 0 auto;
		display: flex;
		justify-content: space-between;
		align-items: center;

		.box-1-1 {
			font-size: 30rpx;
			font-family: Alibaba PuHuiTi;
			font-weight: 600;
			color: #333333;
		}

		.box-1-2 {
			display: flex;
			align-items: center;

			.box-1-2text {
				font-size: 24rpx;
				font-family: Alibaba PuHuiTi;
				font-weight: 500;
				color: #333333;
			}

			>image {
				margin-left: 10rpx;
				width: 30rpx;
				height: 30rpx;
			}
		}
	}

	.box-2 {
		width: 86vw;
		margin: 30rpx auto;
		display: flex;
		justify-content: space-between;
		align-items: center;

		.box-2-1 {
			display: flex;
			align-items: center;


			>image {
				width: 54rpx;
				height: 54rpx;
				margin-right: 20rpx;
			}

			.box-2-2 {
				.box-2-2text {
					margin-bottom: 20rpx;
					font-size: 30rpx;
					font-family: Alibaba PuHuiTi;
					font-weight: 600;
					color: #333333;
				}

				.box-2-2text1 {
					font-size: 24rpx;
					font-family: Alibaba PuHuiTi;
					font-weight: 400;
					color: #999999;
				}
			}
		}

		>image {
			width: 11rpx;
			height: 20rpx;
		}
	}
</style>
